#include <iostream>
#include "Decorator.h"
#include "Component.h"

using namespace std;

Decorator::Decorator(Component* cmp)
	: m_cmp(cmp)
{

}

Decorator::~Decorator()
{
	if (m_cmp != NULL)
	{
		delete m_cmp;
		m_cmp = NULL;
	}
}

ConcreteDecoratorA::ConcreteDecoratorA(Component* cmp)
	: Decorator(cmp)
{

}

ConcreteDecoratorA::~ConcreteDecoratorA()
{

}

void ConcreteDecoratorA::Print()
{
	m_cmp->Print();
	Another();
}

void ConcreteDecoratorA::Another()
{
	std::cout << "Another A" << std::endl;
}

ConcreteDecoratorB::ConcreteDecoratorB(Component* cmp)
	: Decorator(cmp)
{

}

ConcreteDecoratorB::~ConcreteDecoratorB()
{

}

void ConcreteDecoratorB::Print()
{
	m_cmp->Print();
	Another();
}

void ConcreteDecoratorB::Another()
{
	std::cout << "Another B" << std::endl;
}